Add a vfunc for gdk_notify_startup_complete
authorMatthias Clasen <mclasen@redhat.com>
Tue, 14 Dec 2010 01:46:00 +0000 (20:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 21 Dec 2010 17:06:59 +0000 (12:06 -0500)
At the same time, add a display api for this, since it really
is per-display.

gdk/gdk.symbols
gdk/gdkdisplay.c
gdk/gdkdisplay.h
gdk/gdkdisplayprivate.h
gdk/x11/gdkdisplay-x11.c

index d47c4e25ddecacf197f20ee3de2155d16b85cc7a..6093cc44b6567a9cba7b7235db3359fa05e65087 100644 (file)
@@ -109,6 +109,7 @@ gdk_display_manager_get_default_display
 gdk_display_manager_get_type G_GNUC_CONST
 gdk_display_manager_list_displays
 gdk_display_manager_set_default_display
+gdk_display_notify_startup_complete
 gdk_display_open
 gdk_display_open_default_libgtk_only
 gdk_display_peek_event
index d78e7c938730a6373426c11be2d36a38608657ce..321c6cb17eb4604125b065bcdd9257a91fa144c6 100644 (file)
@@ -2449,3 +2449,56 @@ _gdk_display_get_next_serial (GdkDisplay *display)
 {
   return GDK_DISPLAY_GET_CLASS (display)->get_next_serial (display);
 }
+
+
+/**
+ * gdk_notify_startup_complete:
+ *
+ * Indicates to the GUI environment that the application has finished
+ * loading. If the applications opens windows, this function is
+ * normally called after opening the application's initial set of
+ * windows.
+ *
+ * GTK+ will call this function automatically after opening the first
+ * #GtkWindow unless gtk_window_set_auto_startup_notification() is called
+ * to disable that feature.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_notify_startup_complete (void)
+{
+  gdk_notify_startup_complete_with_id (NULL);
+}
+
+/**
+ * gdk_notify_startup_complete_with_id:
+ * @startup_id: a startup-notification identifier, for which notification
+ *              process should be completed
+ *
+ * Indicates to the GUI environment that the application has finished
+ * loading, using a given identifier.
+ *
+ * GTK+ will call this function automatically for #GtkWindow with custom
+ * startup-notification identifier unless
+ * gtk_window_set_auto_startup_notification() is called to disable
+ * that feature.
+ *
+ * Since: 2.12
+ */
+void
+gdk_notify_startup_complete_with_id (const gchar* startup_id)
+{
+  GdkDisplay *display;
+
+  display = gdk_display_get_default ();
+  if (display)
+    gdk_display_notify_startup_complete (display, startup_id);
+}
+
+void
+gdk_display_notify_startup_complete (GdkDisplay  *display,
+                                     const gchar *startup_id)
+{
+  GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
+}
index 0b9f688b6adae592d51e8b11ed47c7947f1ec1f9..9bb1ba962db60f19048127f48f9d100f2c831417 100644 (file)
@@ -235,12 +235,13 @@ void     gdk_display_store_clipboard                (GdkDisplay    *display,
 gboolean gdk_display_supports_shapes           (GdkDisplay    *display);
 gboolean gdk_display_supports_input_shapes     (GdkDisplay    *display);
 gboolean gdk_display_supports_composite        (GdkDisplay    *display);
+void     gdk_display_notify_startup_complete   (GdkDisplay    *display,
+                                                const gchar   *startup_id);
 
 GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display);
 
 GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);
 
-
 G_END_DECLS
 
 #endif /* __GDK_DISPLAY_H__ */
index 4772041e056997fbff554884d2ee223f16c85638..9e8cb4c7c4a36e0b353d86592f349d8e4b974d7f 100644 (file)
@@ -175,6 +175,9 @@ struct _GdkDisplayClass
 
   gulong                     (*get_next_serial) (GdkDisplay *display);
 
+  void                       (*notify_startup_complete) (GdkDisplay  *display,
+                                                         const gchar *startup_id);
+
   /* Signals */
   void (*closed) (GdkDisplay *display,
                   gboolean    is_error);
index 194b25fe7357291c7699dbba164c263c4b964673..126d0288d0de564f4c0f44e7949a7541045ddbfa 100644 (file)
@@ -2062,72 +2062,27 @@ gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
   va_end (ap);
 
   broadcast_xmessage (display,
-                     "_NET_STARTUP_INFO",
+                      "_NET_STARTUP_INFO",
                       "_NET_STARTUP_INFO_BEGIN",
                       message->str);
 
   g_string_free (message, TRUE);
 }
 
-/**
- * gdk_notify_startup_complete:
- * 
- * Indicates to the GUI environment that the application has finished
- * loading. If the applications opens windows, this function is
- * normally called after opening the application's initial set of
- * windows.
- * 
- * GTK+ will call this function automatically after opening the first
- * #GtkWindow unless gtk_window_set_auto_startup_notification() is called 
- * to disable that feature.
- *
- * Since: 2.2
- **/
-void
-gdk_notify_startup_complete (void)
-{
-  GdkDisplay *display;
-  GdkDisplayX11 *display_x11;
-
-  display = gdk_display_get_default ();
-  if (!display)
-    return;
-  
-  display_x11 = GDK_DISPLAY_X11 (display);
-
-  if (display_x11->startup_notification_id == NULL)
-    return;
-
-  gdk_notify_startup_complete_with_id (display_x11->startup_notification_id);
-}
-
-/**
- * gdk_notify_startup_complete_with_id:
- * @startup_id: a startup-notification identifier, for which notification
- *              process should be completed
- * 
- * Indicates to the GUI environment that the application has finished
- * loading, using a given identifier.
- * 
- * GTK+ will call this function automatically for #GtkWindow with custom
- * startup-notification identifier unless
- * gtk_window_set_auto_startup_notification() is called to disable
- * that feature.
- *
- * Since: 2.12
- **/
-void
-gdk_notify_startup_complete_with_id (const gchar* startup_id)
+static void
+gdk_x11_display_notify_startup_complete (GdkDisplay  *display,
+                                         const gchar *startup_id)
 {
-  GdkDisplay *display;
-
-  display = gdk_display_get_default ();
-  if (!display)
-    return;
+  if (startup_id == NULL)
+    {
+      startup_id = GDK_DISPLAY_X11 (display)->startup_notification_id;
+      if (startup_id == NULL)
+        return;
+    }
 
   gdk_x11_display_broadcast_startup_message (display, "remove",
-                                            "ID", startup_id,
-                                            NULL);
+                                             "ID", startup_id,
+                                             NULL);
 }
 
 static gboolean
@@ -2754,5 +2709,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
   display_class->before_process_all_updates = _gdk_x11_display_before_process_all_updates;
   display_class->after_process_all_updates = _gdk_x11_display_after_process_all_updates;
   display_class->get_next_serial = gdk_x11_display_get_next_serial;
+  display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
 }